package chapter07.chapter7_1_Move_Method.ver02;

/**
 * 账户类
 */
public class Account {

    private AccountType _type;

    /**
     * 透支的天数
     */
    private int _daysOverdrawn;

    /**
     * 透支费用
     *
     * @return
     */
    double overdraftCharge() {
        return _type.overdraftCharge(_daysOverdrawn);
    }

    /**
     * 给银行的费用：基本费用 + 透支费用
     *
     * @return
     */
    double bankCharge() {
        double result = 4.5;
        if (_daysOverdrawn > 0) {
            result += overdraftCharge();
        }
        return result;
    }
}
